package com.share.device.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.share.device.domain.CabinetSlot;
import com.share.device.mapper.CabinetSlotMapper;
import com.share.device.service.ICabinetSlotService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author ZhouShuang
 * @version 17
 * @Title
 * @date 2025/10/23 下午8:22
 */
@Service
@RequiredArgsConstructor
public class CabinetSlotService extends ServiceImpl<CabinetSlotMapper, CabinetSlot> implements ICabinetSlotService {
    private final CabinetSlotMapper cabinetSlotMapper;


    /**
     * 根据插槽编号查询插槽信息
     *
     * @param slotNo
     * @return
     */
    @Override
    public CabinetSlot getBySlotNo(Long cabinetId,String slotNo) {
        LambdaQueryWrapper<CabinetSlot> lambdaQueryWrapper = new LambdaQueryWrapper<CabinetSlot>()
                .eq(CabinetSlot::getSlotNo, slotNo)
                .eq(CabinetSlot::getCabinetId, cabinetId);
        return cabinetSlotMapper.selectOne(lambdaQueryWrapper);
    }
}
